/*
 * clog_format.h
 *
 *  Created on: 2012-8-18
 *      Author: lin
 */

#ifndef CLOG_FORMAT_H_
#define CLOG_FORMAT_H_

#include "def/defs.h"
#include "zmalloc/zmalloc.h"

typedef struct clog_format_s {
    char *name;
    char *pattern;
    char content[0];
} clog_format_t;

clog_format_t *clog_format_new(const char *line);
void clog_format_free(clog_format_t *format);
clog_format_t *clog_format_dup(const clog_format_t *src);

int clog_format_guess_enough(clog_format_t *format,clog_event_t *event,int32_t buflen);
int clog_format_gen_msg(const clog_format_t *format,clog_event_t *event,char *buf,int32_t buflen);
#endif /* CLOG_FORMAT_H_ */
